#
# @lc app=leetcode.cn id=171 lang=python3
#
# [171] Excel表列序号
#

# @lc code=start
class Solution:
    def titleToNumber(self, s: str) -> int:
        sum = 0
        for i in range(len(s)):
            sum += (ord(s[i]) - 64) * 26 ** (len(s) - i - 1)
        return sum

# @lc code=end

